Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix env var propagation with telemetry enabled #1123

Merged

Conversation

vfreex
Copy link
Contributor

@vfreex vfreex commented Nov 15, 2024

When OpenTelemetry is enabled, environment variables TRACEPARENT needs to be set for child process for trace context propagation.

There is a bug in cmd_gather_async: If parameter env is not set or set to None, all environment variables of the current process will be passed to the child process. However, when injecting TRACEPARENT, we pass {'TRACEPARENT': 'something'} into child process without other environment variables of the current process, causing misbehavior in the child process.

This PR will fix this by copying all environment variables of the current process if env is not set.

@vfreex vfreex force-pushed the fix-env-vars-for-trace-context branch from c1419c2 to 71a923e Compare November 15, 2024 08:26
When OpenTelemetry is enabled, environment variables `TRACEPARENT` needs
to be set for child process for trace context propagation.

There is a bug in `cmd_gather_async`: If parameter `env` is not set or
set to `None`, all environment variables of the current process will be
passed to the child process. However, when injecting `TRACEPARENT`, we
pass `{'TRACEPARENT': 'something'}` into child process without other
environment variables of the current process, causing misbehavior in the
child process.

This PR will fix this by copying all environment variables of the
current process if `env` is not set.
@vfreex vfreex force-pushed the fix-env-vars-for-trace-context branch from 71a923e to ef5acde Compare November 15, 2024 08:29
Copy link
Contributor

openshift-ci bot commented Nov 15, 2024

@vfreex: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/security ef5acde link false /test security

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@lgarciaaco
Copy link
Contributor

/approve
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 15, 2024
Copy link
Contributor

openshift-ci bot commented Nov 15, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lgarciaaco

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 15, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 2946ab9 into openshift-eng:main Nov 15, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants